# file: multicore_test08.py
import machine
import _thread
import utime

def run_on_core1():
    lock.acquire()
    print("[core1] run thread")
    utime.sleep_ms(1000)
    lock.release()

def run_on_core0():
    while True:
        print("[core0] start thread:")
        lock.acquire()
        _thread.start_new_thread(run_on_core1, ( ))
        lock.release()
        utime.sleep_ms(100)

lock = _thread.allocate_lock()
run_on_core0()
